﻿//======================================================
//==     (c)2013 OpenLayers.cn inc by 飞龙在天 v1.0   ==
//==          Forum:bbs.OpenLayers.cn                 ==
//==         Website:www.OpenLayers.cn                ==
//== 开源旗舰版见 淘宝: http://giscenter.taobao.com   ==
//======================================================
namespace Common
{
    using System;

    public class Bounds
    {
        public double MaxX;
        public double MaxY;
        public double MinX;
        public double MinY;

        public Bounds()
        {
        }

        public Bounds(double _minx, double _miny, double _maxx, double _maxy)
        {
            this.MinX = _minx;
            this.MinY = _miny;
            this.MaxX = _maxx;
            this.MaxY = _maxy;
        }

        public override string ToString()
        {
            return ("minx as " + System.Convert.ToString(this.MinX) + "  miny as " + System.Convert.ToString(this.MinY) + " maxx as " + System.Convert.ToString(this.MaxX) + "  maxy as " + System.Convert.ToString(this.MaxY));
        }

        public XY CentroidPoint
        {
            get
            {
                XY xy2 = new XY();
                double num3 = Math.Min(this.MinX, this.MaxX);
                double num4 = Math.Min(this.MinY, this.MaxY);
                double num = Math.Max(this.MinX, this.MaxX);
                double num2 = Math.Max(this.MinY, this.MaxY);
                xy2.X = num3 + ((num - num3) / 2.0);
                xy2.Y = num4 + ((num2 - num4) / 2.0);
                return xy2;
            }
        }
    }
}

